package com.rabbitmq.demo.confirm;

import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;

public class Sender {

    @Autowired
    private RabbitTemplate rabbitTemplate;

   @Scheduled(fixedDelay = 10000,initialDelay = 0)
    public void send(){
        // 消息成功到达交换机
        rabbitTemplate.convertAndSend("direct.exchange","queue","Hello World!",new CorrelationData(rabbitTemplate.getUUID()));
   }
}
